@use "../HTTPFuzzerPageShare.module.scss" as HTTPFuzzerPageShare;

.flex-space-between-and-center {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.flex-center {
    display: flex;
    align-items: center;
}

.icon-active {
    color: var(--Colors-Use-Main-Primary);
}
.matching-extraction-resize-box {
    height: 100%;
    min-height: 300px;
    .matching-extraction-editor {
        padding-top: 16px;
        background-color: var(--Colors-Use-Neutral-Bg-Hover);
        height: 100%;
        :global {
            .monaco-editor .scroll-decoration {
                box-shadow: none;
            }
        }
    }
}

.matching-extraction {
    display: flex;
    flex: 1;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    .matching-extraction-heard {
        @extend .flex-space-between-and-center;
        height: 40px;
        padding: 8px 16px 8px 12px;
        background: var(--Colors-Use-Neutral-Bg-Hover);
        border-bottom: 1px solid var(--Colors-Use-Neutral-Border);
        .matching-extraction-title {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-shrink: 0;
        }
        .matching-extraction-title-tip {
            font-weight: 400;
            font-size: 12px;
            line-height: 16px;
            color: var(--Colors-Use-Neutral-Text-4-Help-text);
            .primary-number {
                color: var(--Colors-Use-Main-Primary);
                margin: 0 4px;
            }
        }
        .matching-extraction-extra {
            @extend .flex-space-between-and-center;
            gap: 8px;
        }
    }
    .matching-extraction-content {
        position: relative;
        overflow-y: auto;
        padding: 8px;
        :global {
            .ant-collapse-item > .ant-collapse-header {
                border-top: 0;
            }
            .ant-collapse > .ant-collapse-item > .ant-collapse-header {
                background: var(--Colors-Use-Neutral-Bg);
                border-radius: 4px 4px 0px 0px;
                border-bottom: 1px solid transparent;
            }
            .ant-collapse-item-active .ant-collapse-header {
                border-bottom-color: var(--Colors-Use-Neutral-Border) !important;
            }
            .ant-collapse-ghost > .ant-collapse-item > .ant-collapse-content > .ant-collapse-content-box {
                padding: 0;
            }
            .ant-collapse-item {
                border: 1px solid var(--Colors-Use-Neutral-Border);
                border-radius: 4px !important;
            }
            .ant-collapse-item + .ant-collapse-item {
                margin-top: 8px;
            }
            .ant-collapse-ghost > .ant-collapse-item:last-child {
                border-bottom: 1px solid var(--Colors-Use-Neutral-Border);
            }
        }

        .matching-list-item {
            border: 1px solid var(--Colors-Use-Neutral-Border);
            border-radius: 8px;
            margin-bottom: 12px;
        }
        .matching-extraction-condition {
            @extend .flex-space-between-and-center;
            padding: 12px 12px 8px;
            background-color: var(--Colors-Use-Basic-Background);
            border-radius: 8px;
            flex-wrap: wrap;
            gap: 8px 0;
            .matching-extraction-condition-left {
                @extend .flex-center;
                gap: 8px;
                .condition-mode {
                    @extend .flex-center;
                    .condition-mode-text {
                        font-weight: 400;
                        font-size: 12px;
                        line-height: 16px;
                        margin-right: 4px;
                        color: var(--Colors-Use-Neutral-Text-1-Title);
                    }
                }
            }
            .matching-extraction-condition-right {
                @extend .flex-center;
                gap: 8px;
            }
        }
        .matcher-extraction-collapse {
            padding: 0px 12px 12px;
            .collapse-panel-header {
                @extend .flex-center;
                gap: 4px;
                .header-id {
                    color: var(--Colors-Use-Neutral-Text-4-Help-text);
                    @extend .flex-center;
                    gap: 4px;
                    margin-right: 8px;
                }
                .header-number {
                    @include HTTPFuzzerPageShare.circle-number;
                    max-width: 100px;
                }
            }
        }
    }
    .matching-extraction-content-hidden {
        display: none;
    }
    .remove-icon {
        margin-left: 8px;
        color: var(--Colors-Use-Neutral-Text-4-Help-text);
        svg {
            width: 16px;
            height: 16px;
        }
    }
}
.trash-icon {
    color: var(--Colors-Use-Error-Primary);
    @include HTTPFuzzerPageShare.base-icon-card;
}
.collapse-panel-condition {
    background-color: var(--Colors-Use-Neutral-Bg);
    padding: 12px 8px;
}
.collapse-panel-condition-notEditable {
    pointer-events: none;
}
.matching-extraction-list-value {
    padding: 12px 8px;
    .matcher-item-textarea-body {
        position: relative;
        display: flex;
        flex: 1;
        min-height: 24px;
        &:hover,
        &:active,
        &:focus {
            .matcher-item-textarea,
            .resizer-icon {
                background-color: var(--Colors-Use-Neutral-Bg-Hover);
            }
        }
        textarea::placeholder {
            color: var(--Colors-Use-Neutral-Text-4-Help-text);
            font-size: 12px;
        }
        textarea::-webkit-resizer {
            background-color: transparent;
        }
        .matcher-item-textarea {
            border: 0;
            width: 100%;
            outline: none;
            outline: 0;
            padding: 4px 8px;
            border-radius: 4px;
            overflow-y: overlay;
            min-height: 24px;
            line-height: 16px;
            background-color: var(--Colors-Use-Basic-Background);
            color: var(--Colors-Use-Neutral-Text-1-Title);
            &::placeholder{
                color: var(--Colors-Use-Neutral-Text-4-Help-text);
            }
        }
        .resizer-icon {
            position: absolute;
            bottom: 6px;
            right: 4px;
            color: var(--Colors-Use-Neutral-Text-1-Title);
            z-index: 0;
            pointer-events: none;
        }
        .matcher-item-text {
            word-break: break-all;
            line-height: 16px;
            padding: 4px 8px;
            white-space: break-spaces;
        }
    }
    .matcher-item-operate {
        @extend .flex-center;
        gap: 4px;
        margin-left: 4px;
        .adjustments-icon {
            color: var(--Colors-Use-Neutral-Text-1-Title);
            @include HTTPFuzzerPageShare.base-icon-card;
            &:hover {
                background-color: var(--Colors-Use-Neutral-Bg);
                color: var(--Colors-Use-Main-Primary);
            }
        }
    }
    .add-matcher {
        display: flex;
        flex-direction: column;
        flex: 1;
        .divider {
            height: 1px;
            width: 100%;
            background-color: var(--Colors-Use-Neutral-Border);
            transform: scaleY(0.5);
            transform-origin: 50% 100%;
        }
    }
}
.label-node {
    display: flex;
    align-items: self-start;
    font-size: 12px;
    color: var(--Colors-Use-Neutral-Text-1-Title);
    min-height: 24px;
    .label {
        width: 104px;
        margin-right: 4px;
        height: 24px;
        @extend .flex-center;
        justify-content: flex-end;
        flex-shrink: 0;
        transition: all 0.3s;
    }
}

.label-node-column {
    flex-direction: column;
    .label {
        justify-content: flex-start;
    }
}

.label-node + .label-node {
    margin-top: 8px;
}

.color-select-popover {
    padding-top: 4px;
    width: 136px;
    :global {
        .ant-popover-inner-content {
            padding: 0;
        }
        .ant-popover-arrow {
            top: initial !important;
        }
    }
    .color-select-content {
        display: flex;
        flex-direction: column;
        color: var(--Colors-Use-Neutral-Text-1-Title);
        .hit-color {
            font-weight: 500;
            font-size: 12px;
            line-height: 16px;
            padding: 8px 12px 0;
        }
        .color-list {
            padding: 4px;
            .color-list-item {
                display: flex;
                align-items: center;
                gap: 12px;
                height: 28px;
                padding: 6px 8px;
                cursor: pointer;
                border-radius: 4px;

                &:hover {
                    background-color: var(--Colors-Use-Neutral-Bg);
                }
                .color-chunk {
                    width: 16px;
                    height: 16px;
                    border-radius: 50%;
                }
            }
            .color-list-item-active {
                background-color: var(--Colors-Use-Main-Bg);
            }
        }
    }
}
.color-select-btn {
    margin-left: 8px;
    width: 24px;
    height: 24px;
    @extend .flex-center;
    justify-content: center;
    // border: 1px solid var(--Colors-Use-Neutral-Border);
    border-radius: 50%;
    color: var(--Colors-Use-Neutral-Text-1-Title);
    cursor: pointer;
    &:hover {
        color: var(--Colors-Use-Main-Primary);
        border-color: var(--Colors-Use-Main-Primary);
    }
}
.color-select-btn-small {
    width: 20px;
    height: 20px;
    svg {
        width: 14px;
        height: 14px;
    }
}
.color-select-btn-active {
    color: var(--Colors-Use-Main-Primary);
    border-color: var(--Colors-Use-Main-Primary);
}

.edit-name-popover {
    :global {
        .ant-popover-inner-content {
            padding: 12px;
        }
    }
    .edit-name-popover-content {
        display: flex;
        flex-direction: column;
        gap: 4px;
        &-title {
            color: var(--Colors-Use-Neutral-Text-1-Title);
            font-weight: 500;
            font-size: 12px;
            line-height: 16px;
        }
    }
}

.extract-results {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}
